package tech.aistar.corejava.day13;

import java.io.*;

/**
 * @author success
 * @version 1.0
 * @description:本类用来演示:文件的拷贝
 * @date 2019/8/2 0002
 */
public class FileCopyDemo {
    public static void main(String[] args) {
        //JDK7.0语法糖...
        //声明在try()中的资源,释放的权限交给了jvm
        try(BufferedReader br = new BufferedReader(new FileReader("src/tech/aistar/corejava/day13/ObjectDemo.java"));
            PrintWriter out = new PrintWriter(new FileWriter("src/tech/aistar/corejava/day13/ObjectDemo_副本.java"))) {

            while(true){
                String line = br.readLine();//读取一行

                if(line == null)
                    break;

                out.println(line);
            }

            System.out.println("文件拷贝成功!");

        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
